
// webpack.config.js
const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')

module.exports = {
  mode: 'development',
  entry: path.join(__dirname, 'src', 'app.vue'),
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js'
  },
  module: {
    rules: [
      { test: /.vue$/, use: "vue-loader" },
      { test: /\.css$/, use: 'css-loader' },
      {
        test: /\.s(c|a)ss$/,
        use: [
          'vue-style-loader',
          'css-loader',
          {
            loader: 'sass-loader',
            // Requires sass-loader@^7.0.0
            options: {
              implementation: require('sass'),
              indentedSyntax: true // optional
            },
            // Requires >= sass-loader@^8.0.0
            options: {
              implementation: require('sass'),
              sassOptions: {
                indentedSyntax: true // optional
              },
            },
          },
        ],
      },
    ],
  },
  devServer: {
    host: '0.0.0.0',
    port: 8000,
    open: false,
    hot: true,
    // static: path.join(__dirname, 'dist'),
    // 代理配置
    proxy: {
      '/todolist': {
        target: 'http://localhost:3000/todolist',
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          '^/todolist': ''
        }
      }
    }
  },
  plugins:[
    new VueLoaderPlugin(),
  ]
} 